package org.lib.postgresqlhello.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * 测试使用 UserMapper
 * @author ben
 * @date 2021-11-04 20:29:00 CST
 */
//@Component
@Slf4j
public class UserRunner implements ApplicationRunner {

	@Autowired
	private UserMapper um;
	
	@Override
	public void run(ApplicationArguments args) throws Exception {
		User u = new User();
		u.setName("tom");
		u.setAge(1);
		u.setEmail("tomt@lib.org");
		int ret1 = um.insert(u);
		log.warn("ret1={}, u={}", ret1, u);
		
		User findu = um.selectById(u.getId());
		log.warn("findu={}", findu);
	}

}
